<template>
  <div class="all">
    <van-cell-group class="my-info" v-if="mine">
      <van-cell value="内容" center class="base-info" :border="false">
        <template #icon>
          <van-image
            round
            fit="cover"
            src="https://img01.yzcdn.cn/vant/cat.jpeg"
          />
        </template>
        <template #title> 昵称 </template>
        <van-button size="small" round class="update-btn">编辑资料</van-button>
      </van-cell>
      <van-grid :border="false" class="date-info">
        <van-grid-item>
          <template #text>
            <div class="span">1</div>
            <div class="text">头条</div>
          </template>
        </van-grid-item>
        <van-grid-item
          ><template #text>
            <div class="span">2</div>
            <div class="text">粉丝</div>
          </template>
        </van-grid-item>
        <van-grid-item
          ><template #text>
            <div class="span">3</div>
            <div class="text">关注</div>
          </template>
        </van-grid-item>
        <van-grid-item
          ><template #text>
            <div class="span">4</div>
            <div class="text">换赞</div>
          </template>
        </van-grid-item>
      </van-grid>
    </van-cell-group>
    <div class="denglu" v-else>
      <van-image
        width="80"
        height="80"
        round
        fit="cover"
        src="https://img01.yzcdn.cn/vant/cat.jpeg"
      />
      <div class="text" @click="$router.push('/login')">登录/注册</div>
    </div>
    <van-grid :column-num="2" class="nav-l marr">
      <van-grid-item icon="star-o" text="收藏" class="coucang" />
      <van-grid-item icon="underway-o" text="历史" />
    </van-grid>
    <van-cell title="消息通知" is-link to="/cats" />
    <van-cell title="回到主页" is-link to="/home" class="marr" />
    <van-cell v-if="mine" @click="tuichu" title="退出登录" class="tuichu" />
  </div>
</template>

<script>
export default {
  name: "wang",
  components: {
	  
  },
  data() {
    return {
      mine: this.$store.state.user,
    };
  },
  computed: {},
  methods: {
    tuichu() {
     this.$dialog.confirm({
        title: "退出提示",
        message: "确认退出吗？",
      })
        .then(() => {
		  	this.$store.commit("setUser",null);
       location.reload()
        })
        .catch(() => {

        });
    },
  },
};
</script>

<style lang="scss" scoped>
.all {
  .my-info {
    background-image: url(../../assets/img/1.jpg);
    background-size: cover;
    .base-info {
      box-sizing: border-box;
      height: 115px;
      background-color: unset;
      .van-image {
        width: 66px;
        height: 66px;
        margin-right: 20px;
        border: 1px solid #fff;
      }
      .update-btn {
        height: 20px;
      }
      ::v-deep .van-cell__title {
        color: #fff !important;
      }
    }
    ::v-deep .van-grid-item__content {
      background-color: unset;
    }
  }
}
.date-info {
  height: 65px;
  color: #fff;
  .span {
    font-size: 8px;
  }
  .text {
    font-size: 14px;
  }
}
::v-deep .nav-l {
  height: 60px;
  .van-grid-item__icon {
    font-size: 20px;
  }
}
.tuichu {
  text-align: center;
  color: rgb(238, 132, 11);
}
.marr {
  margin-bottom: 18px;
}
.denglu {
  height: 180px;
  background-image: url(../../assets/img/1.jpg);
  background-size: cover;
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
  .text {
    font-size: 16px;
    color: #fff;
  }
}
</style>
